<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><s:text name="title"/></title>
<link href="<%=request.getContextPath()%>/stage/css/inside.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/stage/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/stage/js/json2.js"></script>
<script type="text/JavaScript">
<!--
$(document).ready(function() {
	$("#fdiv a").css('cursor','pointer');     //统一设置查询链接为手形
    $("#fdiv a").click(function(){         //点击查询条件，改变颜色
    	if($(this).css('color')=='yellow'){
    		$(this).css('color','#ccc');
    	}else{
    		$(this).css('color','yellow');
    	}      	
    	$("#reset").css('color','#ccc'); 
    })
    init();
})
function init(){
	var colorStr='<s:property value="sDiamondBo.colour"/>';
	var purityStr='<s:property value="sDiamondBo.purity"/>';
	var cutterStr='<s:property value="sDiamondBo.cutter"/>';
	var symmetryStr='<s:property value="sDiamondBo.symmetry"/>';
	var buffingStr='<s:property value="sDiamondBo.buffing"/>';
	var fluorescenceStr='<s:property value="sDiamondBo.fluorescence"/>';
	var cerificateStr='<s:property value="sDiamondBo.cerificate"/>';
	if(colorStr!=null&&colorStr.length>=1){
		var arr=colorStr.split(", ");
		$.each($("#colo a"), function(){
			var v1=$(this);
			for(var i=0;i<arr.length;i++){
				if(v1.text()==arr[i]){
					v1.css('color','yellow');
				}
			}
		}); 
	}
	
	if(purityStr!=null&&purityStr.length>1){
		var arr=purityStr.split(", ");
		$.each($("#pure a"), function(){
			var v1=$(this);
			for(var i=0;i<arr.length;i++){
				if(v1.text()==arr[i]){
					v1.css('color','yellow');
				}
			}
		}); 
	}

	if(cutterStr!=null&&cutterStr.length>1){
		var arr=cutterStr.split(", ");
		$.each($("#cut a"), function(){
			var v1=$(this);
			for(var i=0;i<arr.length;i++){
				if(v1.text()==arr[i]){
					v1.css('color','yellow');
				}
			}
		}); 
	}
	if(symmetryStr!=null&&symmetryStr.length>1){
		var arr=symmetryStr.split(", ");
		$.each($("#sym a"), function(){
			var v1=$(this);
			for(var i=0;i<arr.length;i++){
				if(v1.text()==arr[i]){
					v1.css('color','yellow');
				}
			}
		}); 
	}
	if(buffingStr!=null&&buffingStr.length>1){
		var arr=buffingStr.split(", ");
		$.each($("#buf a"), function(){
			var v1=$(this);
			for(var i=0;i<arr.length;i++){
				if(v1.text()==arr[i]){
					v1.css('color','yellow');
				}
			}
		}); 
	}
	if(fluorescenceStr!=null&&fluorescenceStr.length>1){
		var arr=fluorescenceStr.split(", ");
		$.each($("#fluo a"), function(){
			var v1=$(this);
			for(var i=0;i<arr.length;i++){
				if(v1.text()==arr[i]){
					v1.css('color','yellow');
				}
			}
		}); 
	}
	if(cerificateStr!=null&&cerificateStr.length>1){
		var arr=cerificateStr.split(", ");
		$.each($("#cert a"), function(){
			var v1=$(this);
			for(var i=0;i<arr.length;i++){
				if(v1.text()==arr[i]){
					v1.css('color','yellow');
				}
			}
		}); 
	}
	
}
function search(){
	var server ="<%=request.getContextPath()%>/todiamond.action?1=1";
	$.each($("#buf a"), function(name, value){
    	if($(this).css('color')=='yellow'){
    		var flour=$(this).text();
    		server+="&sDiamondBo.buffing="+flour;
      		if('EX'==flour)server+="&sDiamondBo.buffing=excellent";
    		if('VG'==flour)server+="&sDiamondBo.buffing=very good";
    		if('G'==flour)server+="&sDiamondBo.buffing=good";
    		if('F'==flour)server+="&sDiamondBo.buffing=fair";
    	}
	}); 
 	$.each($("#colo a"), function(name, value){
    	if($(this).css('color')=='yellow'){
    		server+="&sDiamondBo.colour="+$(this).text();
    	}
	}); 
	$.each($("#sym a"), function(name, value){
    	if($(this).css('color')=='yellow'){
    		var flour=$(this).text();
    		server+="&sDiamondBo.symmetry="+$(this).text();
       		if('EX'==flour)server+="&sDiamondBo.symmetry=excellent";
    		if('VG'==flour)server+="&sDiamondBo.symmetry=very good";
    		if('G'==flour)server+="&sDiamondBo.symmetry=good";
    		if('F'==flour)server+="&sDiamondBo.symmetry=fair";
    	}
	}); 
	$.each($("#pure a"), function(name, value){
    	if($(this).css('color')=='yellow'){
    		server+="&sDiamondBo.purity="+$(this).text();
    	}
	}); 
	$.each($("#fluo a"), function(name, value){
    	if($(this).css('color')=='yellow'){
    		var flour=$(this).text();
    		server+="&sDiamondBo.fluorescence="+flour;
    		if('None'==flour)server+="&sDiamondBo.fluorescence=N";
    		if('Faint'==flour)server+="&sDiamondBo.fluorescence=F";
    		if('Medium'==flour)server+="&sDiamondBo.fluorescence=M";
    		if('Strong'==flour)server+="&sDiamondBo.fluorescence=ST";
    		if('VeryStrong'==flour)server+="&sDiamondBo.fluorescence=VST";
    	}
	}); 
	$.each($("#cut a"), function(name, value){
    	if($(this).css('color')=='yellow'){
    		var flour=$(this).text();
    		server+="&sDiamondBo.cutter="+$(this).text();
    		if('EX'==flour)server+="&sDiamondBo.cutter=excellent";
    		if('VG'==flour)server+="&sDiamondBo.cutter=very good";
    		if('G'==flour)server+="&sDiamondBo.cutter=good";
    		if('F'==flour)server+="&sDiamondBo.cutter=fair";
    	}
	}); 
	$.each($("#cert a"), function(name, value){
    	if($(this).css('color')=='yellow'){
    		server+="&sDiamondBo.cerificate="+$(this).text();
    	}
	});
	server  = encodeURI(server);
	server = encodeURI(server);//注意要两次 
	document.searchForm.action=server;
	return true;
}
function toreset(){
	$("#fdiv a").css('color','#FFF');
	$("#wmin").val('');
	$("#wmax").val('');
	$("#pmin").val('');
	$("#pmax").val('');
	$("#pmin").val('');
	$("#pmax").val('');
	return false;
}
function addOrDel(checked,batch,price){
	var server;
	if(checked){
		 server ="<%=request.getContextPath()%>/adddia.action";
   	}else{
   		server ="<%=request.getContextPath()%>/deldia.action";
   	}
	$.post(server,{batch:batch,price:price});  
}
function delAll(){
	$("[name='itemcheck']").each(function(){
		$(this).attr("checked", false); 
	}); 
	var server ="<%=request.getContextPath()%>/delalldia.action";
	$.post(server);  
}
var isIE = false;
var isFF = false;

if ((navigator.userAgent.indexOf("MSIE")>0) && (parseInt(navigator.appVersion) >=4)) isIE = true;
if (navigator.userAgent.indexOf("Firefox")>0) isFF = true;

function isNUM(e)
{
var iKeyCode = window.event?e.keyCode:e.which;
if(!(((iKeyCode >= 48) && (iKeyCode <= 57)) || (iKeyCode == 13) || (iKeyCode == 46) || (iKeyCode == 45)

|| (iKeyCode == 37) || (iKeyCode == 39) || (iKeyCode == 8)))
{  
    if (isIE)
    {
        e.returnValue=false;
    }
    else
    {
        e.preventDefault();   //重要 firefox是用prevenDefault()来取消事件的
    }
}
}  

//-->
</script>
</head>

<body onload="MM_preloadImages('<%=request.getContextPath()%>/stage/images/menu0_01.jpg','<%=request.getContextPath()%>/stage/images/menu0_02.jpg','<%=request.getContextPath()%>/stage/images/menu0_03.jpg','<%=request.getContextPath()%>/stage/images/menu0_04.jpg','<%=request.getContextPath()%>/stage/images/menu0_05.jpg','<%=request.getContextPath()%>/stage/images/menu0_06.jpg','<%=request.getContextPath()%>/stage/images/menu0_07.jpg')">
<div class="mainbody">
<%@ include file="head1.jsp"%>
 <div class="intermediate">
    <h1>当前位置：首页&nbsp;&gt;&nbsp;<b><FONT COLOR="#FFCC66">钻石查询</FONT></b></h1>
<%@ include file="left.jsp"%>
    <div class="right">
         <h4><img src="<%=request.getContextPath()%>/stage/images/zscx/zscx_03.jpg" width="158" height="15" /></h4>
		 <div class="jgkz_bt">
		    <ul>
		       <li><img src="<%=request.getContextPath()%>/stage/images/zscx/zscx_07.jpg" width="87" height="29" /></li>
			   <li><img src="<%=request.getContextPath()%>/stage/images/zscx/zscx_14.jpg" width="35" height="29" /></li>
			   <li><img src="<%=request.getContextPath()%>/stage/images/zscx/zscx_09.jpg" width="87" height="29" /></li>
			   <li><img src="<%=request.getContextPath()%>/stage/images/zscx/zscx_14.jpg" width="35" height="29" /></li>
			   <li><img src="<%=request.getContextPath()%>/stage/images/zscx/zscx_11.jpg" width="87" height="29" /></li>
		    </ul>
	  </div>
		 <div class="jgkz" id="fdiv">
		 <form name="searchForm" method="post" onsubmit="return search()">
		<table width="98%" height="165" align="center" cellpadding="0" cellspacing="10">
		   
  <tr>
    <td width="60%" height="11%" valign="baseline"><FONT SIZE="3">重量：</FONT>
      <label>
      <input maxlength="4" id="wmin" value='<s:property value="sDiamondBo.minWeight"/>' name="sDiamondBo.minWeight" type="text" class="kuang" onKeypress=" onKeypress="return isNUM(event);"/>
      </label>-<label>
      <input maxlength="4" id="wmax" value='<s:property value="sDiamondBo.maxWeight"/>' name="sDiamondBo.maxWeight" type="text" class="kuang" onKeypress="return isNUM(event);"/>
      <FONT SIZE="2">克拉</FONT>
      </label></td>
      <td width="40%" height="11%" valign="baseline"><FONT SIZE="3">价格：</FONT>
      <label>
      <input maxlength="8" id="pmin" value='<s:property value="sDiamondBo.minPrice"/>' name="sDiamondBo.minPrice" type="text" class="kuang1" onKeypress="return isNUM(event);"/>
      </label>-<label>
      <input maxlength="8" id="pmax" value='<s:property value="sDiamondBo.maxPrice"/>' name="sDiamondBo.maxPrice" type="text" class="kuang1" onKeypress="return isNUM(event);"/>
      </label></td>
    </tr>
  <tr>
    <td height="11%"><FONT SIZE="3">颜色：</FONT><span class="zise1" id="colo"><a>D</a>|<a>E</a>|<a>F</a>|<a>G</a>|<a>H</a>|<a>I</a>|<a>J</a>|<a>K</a>|<a>L</a>|<a>M</a>|<a>N</a></span></td>
    <td><FONT SIZE="3">切工：</FONT><span class="zise1" id="cut"><a>Ideal</a>|<a>EX</a>|<a>VG</a>|<a>G</a>|<a>F</a></span></td>
    </tr>
  <tr>
    <td height="11%"><FONT SIZE="3">净度：</FONT><span class="zise1" id="pure"><a>IF</a>|<a>VVS1</a>|<a>VVS2</a>|<a>VS1</a>|<a>VS2</a>|<a>SI1</a>|<a>SI2</a>|<a>SI3</a>|<a>P1</a>|<a>P2</a>|<a>P3</a></span></td>
    <td><FONT SIZE="3">对称：</FONT><span class="zise1" id="sym"><a>Ideal</a>|<a>EX</a>|<a>VG</a>|<a>G</a>|<a>F</a></span></td>
    </tr>
  <tr>
    <td height="11%"><FONT SIZE="3">荧光：</FONT><span class="zise1" id="fluo"><a>None</a>|<a>Faint</a>|<a>Medium</a>|<a>Strong</a>|<a>VeryStrong</a></span></td>
  	<td><FONT SIZE="3">抛光：</FONT><span class="zise1" id="buf"><a>Ideal</a>|<a>EX</a>|<a>VG</a>|<a>G</a>|<a>F</a></span></td>
    </tr>
  <tr>
  	
    <td><FONT SIZE="3">证书：</FONT><span class="zise1" id="cert"><a>GIA</a>|<a>HRD</a>|<a>IGI</a>|<a>国检</a></span></td>
    <td><label>
      <input type="image" name="imageField2" src="<%=request.getContextPath()%>/stage/images/common/search2.gif"/>
    </label>
      <label>
      <input type="image" onclick="return toreset()" id="reset" src="<%=request.getContextPath()%>/stage/images/common/reset1.gif" />
      </label></td>
    </tr>
</table>
    </form>
</div>
      <div class="jgkz">
	       <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
             <tr>
               <td height="30" align="center" class="xian_01">货 号 </td>
               <td height="30" align="center" class="xian_01">证 书 </td>
               <td height="30" align="center" class="xian_01">钻 重</td>
               <td height="30" align="center" class="xian_01">形 状</td>
               <td height="30" align="center" class="xian_01">净 度</td>
               <td height="30" align="center" class="xian_01">颜 色</td>
               <td height="30" align="center" class="xian_01">抛 光 </td>
               <td height="30" align="center" class="xian_01"> 对 称 </td>
               <td height="30" align="center" class="xian_01">切 工</td>
               <td height="30" align="center" class="xian_01">荧光</td>
               <td align="center" class="xian_01">实 价</td>
               <td align="center" class="xian_01_1"> 选 中</td>
             </tr>
             
             <s:iterator value="dataList" id="bo" status="u">
				<s:if test="#u.index%2!=0"><tr bgcolor="#1F1F1F"></s:if>
				<s:else><tr></s:else>
				<a href="<%=request.getContextPath()%>/todiadetail.action?diamondid=<s:property value="diamondId"/>" target="_blank">
               <td width="10%" height="30" align="center" class="xian_02"><a href="<%=request.getContextPath()%>/todiadetail.action?type=dia&diamondid=<s:property value="diamondId"/>" target="_blank">
               	<s:if test="#bo.spePrice>0"><img src="<%=request.getContextPath()%>/stage/images/zscx/spe1.jpg" border="0"/></s:if><s:property value="batch"/></a>
               </td>
               <td width="8%" height="30" align="center" class="xian_02">
               	 <s:if test="#bo.lab=='GIA'"><a href="http://www2.gia.edu/reportcheck/index.cfm?fuseaction=home.showReportVerification&reportno=<s:property value="reportNo"/>&weight=<s:property value="weightFomat"/>" target="_blank"></s:if>
              	 <s:property value="lab"/></a>
               </td>
               <td width="8%" height="30" align="center" class="xian_02"><s:property value="weightFomat"/></td>
               <td width="8%" height="30" align="center" class="xian_02"><s:property value="shape"/></td>
               <td width="8%" height="30" align="center" class="xian_02"><s:property value="clarity"/></td>
               <td width="8%" height="30" align="center" class="xian_02"><s:property value="color"/></td>
               <td width="8%" height="30" align="center" class="xian_02"><s:property value="polish"/></td>
               <td width="8%" height="30" align="center" class="xian_02"><s:property value="symmetry"/></td>
               <td width="8%" height="30" align="center" class="xian_02"><s:property value="finalCut"/></td>
               <td width="8%" height="30" align="center" class="xian_02"><s:property value="fluor"/></td>
               <s:if test='#session.USER_TYPE.equals("B")'>
                   <td width="11%" align="center" class="xian_02">
                   	  <s:property value="midPriceFomat"/>
                   </td></a>
               </s:if>
	    	   <s:else>
	    	       <td width="11%" align="center" class="xian_02"><s:property value="buyPriceFomat"/></td></a>
	    	   </s:else>
               
               <td width="6%" align="center"><label>
               <input name="itemcheck" type="checkbox" class="fxk" onclick="addOrDel(this.checked,'<s:property value="batch"/>','<s:property value="buyPriceFomat"/>')"/>
               </label></td>
             </tr>
             </s:iterator>
           </table>
	    </div>
  		 <div class="jgkz_bt" style=" margin:5px auto 0 auto">
           <ul style="height:35px;">
            <s:if test='#session.USER_TYPE.equals("B")'></s:if>
	    	<s:else>
	    	    <li style="float:right"><input type="image" onclick="delAll()" src="<%=request.getContextPath()%>/stage/images/zscx/cxxk.gif" border="0"/> 
          	 <a href="<%=request.getContextPath()%>/totmporder.action"><img src="<%=request.getContextPath()%>/stage/images/zscx/order.gif" border="0"/></a>
          	 </li>
	    	</s:else>
          
			 <li><jsp:include page="page.jsp"/></li>
           </ul>
        </div>
    </div>
 </div>
 <%@ include file="foot.jsp"%>
</div>
</body>
</html>
